]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
overview: Split a public init() function out of the constructor
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 11 Feb 2011 22:53:27 +0000 (23:53 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 16 Feb 2011 18:58:17 +0000 (19:58 +0100)
The Overview does not only hold the different elements visible in
the overview, but is also a central point to manage drag signals.
As objects which are constructed in the overview constructor cannot
access Main.overview (as its constructor has not finished yet), we
use misnamed show/hide methods to work around this limitation, which
are called when entering/leaving the overview.
A better way to handle this problem is to remove the limitation
altogether by splitting the overview constructor between internals,
which remain in the constructor, and more complex objects which
need to access Main.overview, and whose initialization is moved
to a public init() function which is called by main.js after the
overview has been constructed.

https://bugzilla.gnome.org/show_bug.cgi?id=642196

js/ui/main.js
js/ui/overview.js

index 1410d28567dd3de908cef30ba4494da2e09cbd15..265dbf9fd9f05018ef3ab81af166baf4b4b15867 100644 (file)
@@ -145,6 +145,7 @@ function start() {
     windowAttentionHandler = new WindowAttentionHandler.WindowAttentionHandler();
     telepathyClient = new TelepathyClient.Client();
 
+    overview.init();
     statusIconDispatcher.start(messageTray.actor);
 
     ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager();
index 5195df498a5ecc23ae896e61d065371764e12803..71c9bf6f8082e8af8a60a455dd64f1e9fd13c475 100644 (file)
@@ -129,8 +129,6 @@ Overview.prototype = {
         this._capturedEventId = 0;
         this._buttonPressId = 0;
 
-        this.shellInfo = new ShellInfo();
-
         this._workspacesDisplay = null;
 
         this.visible = false;           // animating to overview, in overview, animating out
@@ -152,6 +150,32 @@ Overview.prototype = {
         this._group.hide();
         global.overlay_group.add_actor(this._group);
 
+        this._coverPane.hide();
+
+        // XDND
+        this._dragMonitor = {
+            dragMotion: Lang.bind(this, this._onDragMotion)
+        };
+
+        Main.xdndHandler.connect('drag-begin', Lang.bind(this, this._onDragBegin));
+        Main.xdndHandler.connect('drag-end', Lang.bind(this, this._onDragEnd));
+
+        this._windowSwitchTimeoutId = 0;
+        this._windowSwitchTimestamp = 0;
+        this._lastActiveWorkspaceIndex = -1;
+        this._lastHoveredWindow = null;
+        this._needsFakePointerEvent = false;
+
+        this.workspaces = null;
+    },
+
+    // The members we construct that are implemented in JS might
+    // want to access the overview as Main.overview to connect
+    // signal handlers and so forth. So we create them after
+    // construction in this init() method.
+    init: function() {
+        this.shellInfo = new ShellInfo();
+
         this.viewSelector = new ViewSelector.ViewSelector();
         this._group.add_actor(this.viewSelector.actor);
 
@@ -173,23 +197,6 @@ Overview.prototype = {
         this.dash.actor.add_constraint(this.viewSelector.constrainY);
         this.dash.actor.add_constraint(this.viewSelector.constrainHeight);
 
-        this._coverPane.hide();
-
-        // XDND
-        this._dragMonitor = {
-            dragMotion: Lang.bind(this, this._onDragMotion)
-        };
-
-        Main.xdndHandler.connect('drag-begin', Lang.bind(this, this._onDragBegin));
-        Main.xdndHandler.connect('drag-end', Lang.bind(this, this._onDragEnd));
-
-        this._windowSwitchTimeoutId = 0;
-        this._windowSwitchTimestamp = 0;
-        this._lastActiveWorkspaceIndex = -1;
-        this._lastHoveredWindow = null;
-        this._needsFakePointerEvent = false;
-
-        this.workspaces = null;
     },
 
     _onDragBegin: function() {